<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>java基础：数值类型操作 | haijd</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="Java基础" />
  
  
  
  
  <meta name="description" content="Java基础：数值类型操作">
<meta name="keywords" content="Java基础">
<meta property="og:type" content="article">
<meta property="og:title" content="Java基础：数值类型操作">
<meta property="og:url" content="http://www.hais2.com/2017/05/30/Java基础：数值类型操作/index.html">
<meta property="og:site_name" content="haijd">
<meta property="og:description" content="Java基础：数值类型操作">
<meta property="og:locale" content="default">
<meta property="og:image" content="http://ww1.sinaimg.cn/large/c55a7aeely1fmbwbz5s71j20et08cjra.jpg">
<meta property="og:updated_time" content="2017-12-13T12:25:59.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Java基础：数值类型操作">
<meta name="twitter:description" content="Java基础：数值类型操作">
<meta name="twitter:image" content="http://ww1.sinaimg.cn/large/c55a7aeely1fmbwbz5s71j20et08cjra.jpg">
  
    <link rel="alternate" href="/atom.xml" title="haijd" type="application/atom+xml">
  
  <link rel="icon" href="/css/images/favicon.ico">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/9749f0/00000000000000000001008f/27/l?subset_id=2&fvd=n5) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/90cf9f/000000000000000000010091/27/l?subset_id=2&fvd=n7) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/8a5494/000000000000000000013365/27/l?subset_id=2&fvd=n4) format("woff2");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/d337d8/000000000000000000010095/27/l?subset_id=2&fvd=i4) format("woff2");font-weight:400;font-style:italic;}</style>
    
  <link rel="stylesheet" id="athemes-headings-fonts-css" href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz%3A200%2C300%2C400%2C700&amp;ver=4.6.1" type="text/css" media="all">
  <link rel="stylesheet" href="/css/style.css">

  <script src="/js/jquery-3.1.1.min.js"></script>

  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/css/bootstrap.css" >
  <link rel="stylesheet" href="/css/hiero.css" >
  <link rel="stylesheet" href="/css/glyphs.css" >
  
    <link rel="stylesheet" href="/css/vdonate.css" >
  

</head>

<script>
var themeMenus = {};

  themeMenus["/"] = "Home"; 

  themeMenus["/archives"] = "Archives"; 

  themeMenus["/categories"] = "Categories"; 

  themeMenus["/tags"] = "Tags"; 

  themeMenus["/about"] = "About"; 

</script>


  <body data-spy="scroll" data-target="#toc" data-offset="50">


  <header id="allheader" class="site-header" role="banner">
  <div class="clearfix container">
      <div class="site-branding">

          <h1 class="site-title">
            
              <a href="/" title="haijd" rel="home"> haijd </a>
            
          </h1>

          
            <div class="site-description">Stay Hungry,Stay Foolish</div>
          
            
          <nav id="main-navigation" class="main-navigation" role="navigation">
            <a class="nav-open">Menu</a>
            <a class="nav-close">Close</a>
            <div class="clearfix sf-menu">

              <ul id="main-nav" class="nmenu sf-js-enabled">
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/">Home</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/archives">Archives</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/categories">Categories</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/tags">Tags</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/about">About</a> </li>
                    
              </ul>
            </div>
          </nav>


      </div>
  </div>
</header>




  <div id="container">
    <div id="wrap">
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-Java基础：数值类型操作" style="width: 66%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
  <div id="articleInner" class="clearfix post-1016 post type-post status-publish format-standard has-post-thumbnail hentry category-template-2 category-uncategorized tag-codex tag-edge-case tag-featured-image tag-image tag-template">
    
<div class="article-gallery">
  <div class="article-gallery-photos">
    
      <a class="article-gallery-img fancybox" href="http://ww1.sinaimg.cn/large/c55a7aeely1fmbwbz5s71j20et08cjra.jpg" rel="gallery_cjie4naiv005g3swa1exrvo8c">
        <img src="http://ww1.sinaimg.cn/large/c55a7aeely1fmbwbz5s71j20et08cjra.jpg" itemprop="image">
      </a>
    
  </div>
</div>

    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      Java基础：数值类型操作
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	Posted on <a href="/2017/05/30/Java基础：数值类型操作/" class="article-date">
	  <time datetime="2017-05-30T15:51:32.000Z" itemprop="datePublished">May 30, 2017</time>
	</a>

      
	<span id="busuanzi_container_page_pv">
	  本文总阅读量<span id="busuanzi_value_page_pv"></span>次
	</span>

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <!-- TOC -->
<ul>
<li><a href="#math类的方法">Math类的方法</a></li>
<li><a href="#biginteger类概述和构造方法">BigInteger类概述和构造方法</a></li>
<li><a href="#bigdecimal类操作高精度数据">BigDecimal类操作高精度数据</a></li>
</ul>
<!-- /TOC -->
<h3 id="Math类的方法"><a href="#Math类的方法" class="headerlink" title="Math类的方法"></a>Math类的方法</h3><ul>
<li><code>public static double sqrt(double a)</code><ul>
<li>返回参数的平方根  <figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line"><span class="keyword">double</span> d = Math.sqrt(<span class="number">7</span>);</span><br><span class="line">   	System.out.println(d);  <span class="comment">//输出：2.6457513110645907</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
</ul>
<a id="more"></a>
<ul>
<li><p><code>static double pow(double a, double b)</code></p>
<ul>
<li>返回a的b次方  <figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line">   	<span class="keyword">double</span> d = Math.pow(<span class="number">2</span>, <span class="number">3</span>);</span><br><span class="line">   	System.out.println(d); <span class="comment">//输出：8.0</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p><code>static double floor(double d)</code></p>
<ul>
<li>返回小于或者等于参数d的最大整数(地板函数)    <figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line">   	<span class="keyword">double</span> d = Math.floor(<span class="number">1.5</span>);</span><br><span class="line">   	System.out.println(d);  <span class="comment">//输出：1.0</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p><code>static double ceil(double d)</code></p>
<ul>
<li>返回大于或者等于参数d的最小整数(天花板函数)   </li>
</ul>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line">   	<span class="keyword">double</span> d = Math.ceil(<span class="number">1.1</span>);</span><br><span class="line">   	System.out.println(d);   <span class="comment">//输出：2.0</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li><code>static int abs(int i)</code><ul>
<li>获取参数的绝对值   </li>
</ul>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line">   	<span class="keyword">int</span> i = Math.abs(-<span class="number">3</span>);</span><br><span class="line">   	System.out.println(i); <span class="comment">//输出：3</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li><code>static double round(doubl d)</code><ul>
<li>获取参数的四舍五入,取整数    </li>
</ul>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line">  	<span class="keyword">double</span> d = Math.round(<span class="number">1.4999</span>); </span><br><span class="line">  	System.out.println(d);  <span class="comment">//输出：1.0</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li><code>static double random()</code><ul>
<li>返回随机数 0.0-1.0之间   </li>
</ul>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line">  	<span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span> ; i &lt; <span class="number">10</span> ;i++)&#123;</span><br><span class="line">  		<span class="keyword">double</span> d = Math.random();</span><br><span class="line">  		System.out.println(d); <span class="comment">//0.35730327457447275   0.9478733976632037</span></span><br><span class="line">  	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="BigInteger类概述和构造方法"><a href="#BigInteger类概述和构造方法" class="headerlink" title="BigInteger类概述和构造方法"></a>BigInteger类概述和构造方法</h3><ul>
<li><p>BigInteger类概述和构造方法</p>
<ul>
<li>BigInteger类可以对超大的数值进行操作(远超long类型的最大长度)</li>
<li>构造方法中传递的字符串参数不允许出现数字以外的字符<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">* BigInteger类的构造方法</span></span><br><span class="line"><span class="comment">* 传递字符串,要求数字格式,没有长度限制</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line">   	BigInteger b = <span class="keyword">new</span> BigInteger(<span class="string">"8465846668464684562385634168451684568645684564564"</span>);</span><br><span class="line">   	System.out.println(b);</span><br><span class="line">   	BigInteger b1 = <span class="keyword">new</span> BigInteger(<span class="string">"5861694569514568465846668464684562385634168451684568645684564564"</span>);</span><br><span class="line">   	System.out.println(b1);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>BigInteger类四则运算</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function_1</span><span class="params">()</span></span>&#123;</span><br><span class="line">	BigInteger b1 = <span class="keyword">new</span> BigInteger(<span class="string">"5665464516451051581613661405146"</span>);</span><br><span class="line">	BigInteger b2 = <span class="keyword">new</span> BigInteger(<span class="string">"965855861461465516451051581613661405146"</span>);</span><br><span class="line">		 </span><br><span class="line">	<span class="comment">//计算 b1+b2对象的和,调用方法 add</span></span><br><span class="line">	BigInteger bigAdd = b1.add(b2);<span class="comment">//965855867126930032902103163227322810292</span></span><br><span class="line">	System.out.println(bigAdd);</span><br><span class="line">		 </span><br><span class="line">	<span class="comment">//计算b1-b2对象的差,调用方法subtract</span></span><br><span class="line">	BigInteger bigSub = b1.subtract(b2);</span><br><span class="line">	System.out.println(bigSub);</span><br><span class="line">		 </span><br><span class="line">	<span class="comment">//计算b1*b2对象的乘积,调用方法multiply</span></span><br><span class="line">	BigInteger bigMul = b1.multiply(b2);</span><br><span class="line">	System.out.println(bigMul);</span><br><span class="line">		 </span><br><span class="line">	<span class="comment">//计算b2/b1对象商,调用方法divied</span></span><br><span class="line">	BigInteger bigDiv = b2.divide(b1);</span><br><span class="line">	System.out.println(bigDiv);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="BigDecimal类操作高精度数据"><a href="#BigDecimal类操作高精度数据" class="headerlink" title="BigDecimal类操作高精度数据"></a>BigDecimal类操作高精度数据</h3><ul>
<li><p>BigDecimal类概述</p>
<ul>
<li>BigDecimal可以操作超大型的浮点数据，提供高精度的浮点运算</li>
</ul>
</li>
<li><p>反例：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">* 下列计算结构都不是我们想象中的精度运算</span></span><br><span class="line"><span class="comment">* 原因: 计算机二进制中,表示浮点数不精确造成</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line">System.out.println(<span class="number">0.09</span> + <span class="number">0.01</span>);<span class="comment">//0.09999999999999999</span></span><br><span class="line">System.out.println(<span class="number">1.0</span> - <span class="number">0.32</span>);<span class="comment">//0.6799999999999999</span></span><br><span class="line">System.out.println(<span class="number">1.015</span> * <span class="number">100</span>);<span class="comment">//101.49999999999999</span></span><br><span class="line">System.out.println(<span class="number">1.301</span> / <span class="number">100</span>);<span class="comment">//0.013009999999999999</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>BigDecimal类实现加法减法乘法</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function</span><span class="params">()</span></span>&#123;</span><br><span class="line">  	BigDecimal b1 =  <span class="keyword">new</span> BigDecimal(<span class="string">"0.09"</span>);</span><br><span class="line">  	BigDecimal b2 =  <span class="keyword">new</span> BigDecimal(<span class="string">"0.01"</span>);</span><br><span class="line">  	<span class="comment">//计算b1+b2的和,调用方法add</span></span><br><span class="line">  	BigDecimal bigAdd = b1.add(b2);</span><br><span class="line">  	System.out.println(bigAdd);  <span class="comment">//输出：0.10</span></span><br><span class="line">  		</span><br><span class="line">  	BigDecimal b3 = <span class="keyword">new</span> BigDecimal(<span class="string">"1"</span>);</span><br><span class="line">  	BigDecimal b4 = <span class="keyword">new</span> BigDecimal(<span class="string">"0.32"</span>);</span><br><span class="line">  	<span class="comment">//计算b3-b2的差,调用方法subtract</span></span><br><span class="line">  	BigDecimal bigSub = b3.subtract(b4);</span><br><span class="line">  	System.out.println(bigSub);  <span class="comment">//输出：0.68</span></span><br><span class="line">  		</span><br><span class="line">  	BigDecimal b5 = <span class="keyword">new</span> BigDecimal(<span class="string">"1.015"</span>);</span><br><span class="line">  	BigDecimal b6 = <span class="keyword">new</span> BigDecimal(<span class="string">"100"</span>);</span><br><span class="line">  	<span class="comment">//计算b5*b6的成绩,调用方法 multiply</span></span><br><span class="line">  	BigDecimal bigMul = b5.multiply(b6);</span><br><span class="line">  	System.out.println(bigMul);  <span class="comment">//输出：101.500</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>BigDecimal类实现除法</p>
<ul>
<li><code>divide(BigDecimal divisor, int scale, int roundingMode)</code><ul>
<li>int scale : 保留几位小数</li>
<li>int roundingMode : 保留模式<ul>
<li><code>static int ROUND_UP</code> 向上+1</li>
<li><code>static int ROUND_DOWN</code> 直接舍去</li>
<li><code>static int ROUND_HALF_UP</code> &gt;= 0.5 向上+1</li>
<li><code>static int ROUND_HALF_DOWN</code> &gt; 0.5 向上+1 ,否则直接舍去<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">function_1</span><span class="params">()</span></span>&#123;</span><br><span class="line">	BigDecimal b1 = <span class="keyword">new</span> BigDecimal(<span class="string">"1.1314"</span>);</span><br><span class="line">	BigDecimal b2 = <span class="keyword">new</span> BigDecimal(<span class="string">"100"</span>);</span><br><span class="line">	<span class="comment">//计算b1/b2的商,调用方法divied</span></span><br><span class="line">	BigDecimal bigDiv = b1.divide(b2,<span class="number">6</span>,BigDecimal.ROUND_HALF_UP); </span><br><span class="line">	System.out.println(bigDiv);  <span class="comment">//输出：0.011314</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>

      
    </div>
    <footer class="entry-meta entry-footer">
      
	<span class="ico-folder"></span>
    <a class="article-category-link" href="/categories/Java/">Java</a>

      
  <span class="ico-tags"></span>
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Java基础/">Java基础</a></li></ul>

      
        <div id="donation_div"></div>

<script src="/js/vdonate.js"></script>
<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: '/css/images/wechatPay.png',
  alipayImage: '/css/images/alipay.jpg'
});
</script>
      

      
        
	<section id="comments" class="comment">
	  <div id="disqus_thread">
	  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
	  </div>
	</section>

	<script type="text/javascript">
	var disqus_shortname = 'haijdblog';
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/count.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	</script>


      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2017/06/01/Java基础：集合/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Java基础：集合
        
      </div>
    </a>
  
  
    <a href="/2017/05/28/Java基础：System类/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Java基础：System类</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
      <ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#Math类的方法"><span class="nav-number">1.</span> <span class="nav-text">Math类的方法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#BigInteger类概述和构造方法"><span class="nav-number">2.</span> <span class="nav-text">BigInteger类概述和构造方法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#BigDecimal类操作高精度数据"><span class="nav-number">3.</span> <span class="nav-text">BigDecimal类操作高精度数据</span></a></li></ol>
    
    </div>
  </aside>
</section>
        
      </div>
      <footer id="footer" class="site-footer">
  

  <div class="clearfix container">
      <div class="site-info">
	      &copy; 2018 haijd All Rights Reserved.
          
            <span id="busuanzi_container_site_uv">
              本站访客数<span id="busuanzi_value_site_uv"></span>人次  
              本站总访问量<span id="busuanzi_value_site_pv"></span>次
            </span>
          
      </div>
      <div class="site-credit">
        Theme by <a href="https://github.com/iTimeTraveler/hexo-theme-hiero" target="_blank">hiero</a>
      </div>
  </div>
</footer>


<!-- min height -->

<script>
    var contentdiv = document.getElementById("content");

    contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("allheader").offsetHeight - document.getElementById("footer").offsetHeight + "px";
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/categories" class="mobile-nav-link">Categories</a>
  
    <a href="/tags" class="mobile-nav-link">Tags</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/scripts.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/main.js"></script>








	<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/js/totop.js" async=""></script>
</body>
</html>
